home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / lfsstats / RCS / lfsstats.c,v < prev    next >
Encoding:
Text File  |  1992-04-14  |  2.7 KB  |  144 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     92.04.14.14.12.23;  author mendel;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     91.05.31.13.54.20;  author mendel;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @Program to print out lfsstats counters.
  22. @
  23.  
  24.  
  25. 1.2
  26. log
  27. @Modified to use new library format.
  28. @
  29. text
  30. @/* 
  31.  * showStats.c --
  32.  *
  33.  *    Show the stats of an LFS file system
  34.  *
  35.  * Copyright 1989 Regents of the University of California
  36.  * Permission to use, copy, modify, and distribute this
  37.  * software and its documentation for any purpose and without
  38.  * fee is hereby granted, provided that the above copyright
  39.  * notice appear in all copies.  The University of California
  40.  * makes no representations about the suitability of this
  41.  * software for any purpose.  It is provided "as is" without
  42.  * express or implied warranty.
  43.  */
  44.  
  45. #ifndef lint
  46. static char rcsid[] = "$Header: /sprite/src/admin/lfsstats/RCS/lfsstats.c,v 1.1 91/05/31 13:54:20 mendel Exp Locker: mendel $ SPRITE (Berkeley)";
  47. #endif /* not lint */
  48.  
  49. #include "lfslib.h"
  50. #ifdef _HAS_PROTOTYPES
  51. #include <varargs.h>
  52. #endif
  53. #include <stdio.h>
  54. #include <sys/types.h>
  55. #include <sys/file.h>
  56.  
  57. #include <sprite.h>
  58. #include <unistd.h>
  59. #include <option.h>
  60. #include <stdlib.h>
  61. #include <string.h>
  62.  
  63. int    blockSize = 512;
  64.  
  65. char    *deviceName;
  66.  
  67. Option optionArray[] = {
  68.     {OPT_DOC, (char *) NULL,  (char *) NULL,
  69.     "This program shows the LfsStats structure of an LFS file system.\n Synopsis: \"lfsstats deviceName\""},
  70. };
  71. /*
  72.  * Forward routine declartions. 
  73.  */
  74.  
  75. static void ShowStats _ARGS_((Lfs_Stats *statsPtr));
  76.  
  77. /*
  78.  *----------------------------------------------------------------------
  79.  *
  80.  * main --
  81.  *
  82.  *    Main routine of lfsstats - parse arguments and do the work.
  83.  *
  84.  * Results:
  85.  *    None.
  86.  *
  87.  * Side effects:
  88.  *    None.
  89.  *
  90.  *----------------------------------------------------------------------
  91.  */
  92.  
  93. int
  94. main(argc,argv)
  95.     int    argc;
  96.     char *argv[];
  97. {
  98.     Lfs    *lfsPtr;
  99.  
  100.  
  101.  
  102.     argc = Opt_Parse(argc, argv, optionArray, Opt_Number(optionArray), 0);
  103.     if (argc != 2) { 
  104.          Opt_PrintUsage(argv[0], optionArray, Opt_Number(optionArray));
  105.      exit(1);
  106.     } else {
  107.     deviceName = argv[1];
  108.     }
  109.     lfsPtr = LfsLoadFileSystem(argv[0], deviceName, blockSize, 
  110.             LFS_SUPER_BLOCK_OFFSET,
  111.                 O_RDONLY);
  112.     if (lfsPtr == (Lfs *) NULL) {
  113.     exit(1);
  114.     }
  115.  
  116.     ShowStats(&lfsPtr->stats);
  117.     exit(0);
  118.     return 0;
  119. }
  120. static void
  121. ShowStats(statsPtr)
  122.     Lfs_Stats *statsPtr;
  123. {
  124. #include "statprint.h"
  125. }
  126. @
  127.  
  128.  
  129. 1.1
  130. log
  131. @Initial revision
  132. @
  133. text
  134. @d17 1
  135. a17 1
  136. static char rcsid[] = "$Header: /sprite/lib/forms/RCS/proto.c,v 1.2 89/01/07 04:12:18 rab Exp $ SPRITE (Berkeley)";
  137. d80 1
  138. a80 1
  139.     lfsPtr = LoadFileSystem(argv[0], deviceName, blockSize, 
  140. d87 1
  141. a87 1
  142.     ShowStats(lfsPtr->statsPtr);
  143. @
  144.